/**
 * 
 */
package com.feizhi.common.search.index;

import java.io.Serializable;

import org.apache.lucene.document.Document;

/**
 * @author shuaqiu
 *
 */
public abstract class LuceneWorkHelper<B> {

    public LuceneWork toWork(B bean) {
        LuceneWork work = new LuceneWork();
        work.setEntityType(bean.getClass());
        work.setId(getId(bean));
        work.setDocument(toDocument(bean));
        
        return work;
    }

    protected abstract Serializable getId(B bean);

    protected abstract Document toDocument(B bean);
}
